package com.utstarcom.util;

import org.apache.hadoop.conf.Configuration;

/**
 * Created by Lenovo on 2017/7/26.
 */
public class HDFSConf {

    public static Configuration conf = null;
    public static Configuration getConf(){
        if (conf == null){
            conf = new Configuration();
            //从系统环境变量中获取hadoop_home 目录，找到配置文件,指了uri 和
            String path  = Common.getSysEnv("HADOOP_HOME")+"/etc/hadoop/";
            // hdfs conf
            conf.addResource(path+"core-site.xml");
            conf.addResource(path+"hdfs-site.xml");
            conf.addResource(path+"mapred-site.xml");
            conf.addResource(path+"yarn-site.xml");

            conf.set("fs.hdfs.impl","org.apache.hadoop.hdfs.DistributedFileSystem");
        }
        return conf;
    }

}
